package com.imooc.mall.exception;

import javax.management.RuntimeErrorException;

public class ImoocMallException extends RuntimeException {

    private final Integer code;
    private final String message;


    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public ImoocMallException(Integer code, String message){
        this.message = message;
        this.code = code;
    }

    // 这个是调用两参数的构造函数
    public ImoocMallException(ImoocMallExceptionEnum exceptionEnum){
        this(exceptionEnum.getCode(),exceptionEnum.getMsg());
    }
}